home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / Wizard.java < prev    next >
Text File  |  1998-10-25  |  43KB  |  1,610 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.io.FileWriter;
  4. import java.io.IOException;
  5.  
  6. import java.awt.*;
  7. import java.awt.event.*;
  8. import java.beans.*;
  9. import java.util.Vector;
  10. import java.util.Enumeration;
  11. import java.util.ResourceBundle;
  12.  
  13. /**
  14.  * The Wizard component provides services to create wizards.
  15.  * It maintains a list of pages and uses the services of a
  16.  * WizardController to define its behavior.
  17.  *
  18.  * @see WizardController
  19.  * @see SimpleWizardController
  20.  */
  21. public class Wizard extends Panel implements WizardInterface, java.io.Serializable
  22. {
  23.     /**
  24.      * Constructs a Wizard.
  25.      */
  26.     public Wizard()
  27.     {
  28.         //debug("Wizard");
  29.  
  30.         // Add a GridBagLayout to the Panel base class
  31.  
  32.         GridBagLayout gridBagLayout;
  33.         gridBagLayout = new GridBagLayout();
  34.         super.setLayout(gridBagLayout);
  35.  
  36.         // The first panel will contain the pages
  37.  
  38.         panel1 = new Panel();
  39.         panel1.setLayout(null);
  40.         GridBagConstraints gbc;
  41.         gbc = new GridBagConstraints();
  42.         gbc.gridx = 0;
  43.         gbc.gridy = 0;
  44.         gbc.weightx = 1.0;
  45.         gbc.weighty = 1.0;
  46.         gbc.fill = GridBagConstraints.BOTH;
  47.         gbc.insets = new Insets(0, 0, 0, 0);
  48.         ((GridBagLayout)super.getLayout()).setConstraints(panel1, gbc);
  49.         super.addImpl(panel1, null, -1);
  50.  
  51.         // Horizontal line
  52.  
  53.         horizontalLine1 = new symantec.itools.awt.shape.HorizontalLine();
  54.         try {
  55.             horizontalLine1.setBevelStyle(symantec.itools.awt.shape.HorizontalLine.BEVEL_LOWERED);
  56.         }
  57.         catch(java.beans.PropertyVetoException e) { }
  58.         gbc = new GridBagConstraints();
  59.         gbc.gridx = 0;
  60.         gbc.gridy = 1;
  61.         gbc.weightx = 1.0;
  62.         gbc.fill = GridBagConstraints.BOTH;
  63.         gbc.insets = new Insets(0, 0, 0, 0);
  64.         ((GridBagLayout)super.getLayout()).setConstraints(horizontalLine1, gbc);
  65.         super.addImpl(horizontalLine1, null, -1);
  66.  
  67.         // The second panel contains the navigation buttons and associated panels
  68.  
  69.         panel2 = new Panel();
  70.         panel2.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5));
  71.         gbc = new GridBagConstraints();
  72.         gbc.gridx = 0;
  73.         gbc.gridy = 2;
  74.         gbc.weightx = 1.0;
  75.         gbc.fill = GridBagConstraints.BOTH;
  76.         gbc.insets = new Insets(2, 2, 2, 2);
  77.         ((GridBagLayout)super.getLayout()).setConstraints(panel2, gbc);
  78.         super.addImpl(panel2, null, -1);
  79.  
  80.         // Navigation buttons and associated panels
  81.         
  82.         panel3 = new Panel();
  83.         panel3.setLayout(new GridLayout());
  84.  
  85.         previousButton = new Button();
  86.         previousButton.setActionCommand("button");
  87.         previousButton.setLabel(PREVIOUS_LABEL);
  88.         previousButton.setEnabled(false);
  89.         panel3.add(previousButton);
  90.  
  91.         nextButton = new Button();
  92.         nextButton.setActionCommand("button");
  93.         nextButton.setLabel(NEXT_LABEL);
  94.         nextButton.setEnabled(false);
  95.         panel3.add(nextButton);
  96.  
  97.         finishButton = new Button();
  98.         finishButton.setActionCommand("button");
  99.         finishButton.setLabel(FINISH_LABEL);
  100.         finishButton.setEnabled(false);
  101.         panel3.add(finishButton);
  102.  
  103.         panel4 = new Panel();
  104.         panel4.setLayout(new GridLayout(1, 2, 6, 0));
  105.         
  106.         cancelButton = new Button();
  107.         cancelButton.setActionCommand("button");
  108.         cancelButton.setLabel(CANCEL_LABEL);
  109.         if (!ignoreDesignTime && java.beans.Beans.isDesignTime())
  110.             cancelButton.setEnabled(false);
  111.         
  112.         helpButton = new Button();
  113.         helpButton.setActionCommand("button");
  114.         helpButton.setLabel(HELP_LABEL);
  115.         if (!ignoreDesignTime && java.beans.Beans.isDesignTime())
  116.             helpButton.setEnabled(false);
  117.  
  118.         // Select the button order
  119.  
  120.         if (newButtonOrder) {
  121.             panel2.add(panel4);
  122.             panel2.add(panel3);
  123.             panel4.add(helpButton);
  124.             panel4.add(cancelButton);
  125.         } else {
  126.             panel2.add(panel3);
  127.             panel2.add(panel4);
  128.             panel4.add(cancelButton);
  129.             panel4.add(helpButton);
  130.         }
  131.  
  132.         // Other objects
  133.  
  134.         vPages = new Vector();
  135.         actionListeners = new Vector();
  136.  
  137.         controller = new SimpleWizardController(this);
  138.     }
  139.  
  140.     /**
  141.      * Set the wizard starting page. This has to be called before any
  142.      * page is added.
  143.      */
  144.     public void setFirstPageIndex(int index)
  145.     {
  146.         if (index >= 0)
  147.             firstPageIndex = index;
  148.     }
  149.  
  150.     /**
  151.      * Tell the wizard to ignore the value of java.beans.Beans.isDesignTime().
  152.      */
  153.     public void setIgnoreDesignTime(boolean ignore)
  154.     {
  155.         ignoreDesignTime = ignore;
  156.     }
  157.  
  158.     public boolean getIgnoreDesignTime()
  159.     {
  160.         return ignoreDesignTime;
  161.     }
  162.  
  163.     /**
  164.      * Sets a customized WizardController.
  165.      * This should be done once before actually using the Wizard
  166.      * and after all pages have been added. If no customized
  167.      * WizardController is set, a default SimpleWizardController
  168.      * is used.
  169.      *
  170.      * @see #getWizardController
  171.      */
  172.     public void setWizardController(WizardController controller)
  173.     {
  174.         WizardController oldController = this.controller;
  175.         this.controller = controller;
  176.  
  177.         if (controllerPrepared)
  178.         {
  179.             oldController.doCancel();
  180.             controllerPrepared = false;
  181.  
  182.             initiateController(firstPageIndex);
  183.         }
  184.  
  185.         // Set the buttons status
  186.  
  187.         updateButtonsState();
  188.     }
  189.  
  190.     /**
  191.      * Initiates the WizardController.
  192.      * Begins the WizardController life cycle and shows the
  193.      * first page.
  194.      */
  195.     private void initiateController(int index)
  196.     {
  197.         //debug("initiateController: " + index);
  198.  
  199.         Component comp = getComponentAt(index);
  200.         
  201.         if (!controllerPrepared)
  202.         {
  203.             // Prepare the controller
  204.  
  205.             if (controller instanceof SimpleWizardController)
  206.                 ((SimpleWizardController)controller).doPrepare(index);
  207.             else
  208.                 controller.doPrepare();
  209.             controllerPrepared = true;
  210.  
  211.             // Prepare the new page
  212.  
  213.             controller.resetChainInfo();
  214.             controller.preparePage(comp, WizardController.NEXT);
  215.  
  216.             // Show the new page
  217.  
  218.             showPage(comp);
  219.             curIndex = index;
  220.             controller.pageShown(comp);
  221.         }
  222.     }
  223.  
  224.     /**
  225.      * Restarts the wizard after usage.
  226.      * The WizardController life cycle will be reset and the
  227.      * first page will be shown again.
  228.      */
  229.     public void restart()
  230.     {
  231.         if (controllerPrepared)
  232.         {
  233.             controller.doCancel();
  234.             controllerPrepared = false;
  235.         }
  236.  
  237.         initiateController(firstPageIndex);
  238.     }
  239.  
  240.     /**
  241.      * Get the current WizardController.
  242.      *
  243.      * @see #setWizardController
  244.      */
  245.     public WizardController getWizardController()
  246.     {
  247.         return controller;
  248.     }
  249.  
  250.     /**
  251.      * Returns the zero-relative index of the currently selected page.
  252.      * @return the currently selected page or -1 if none are shown
  253.      */
  254.     public int getSelectedIndex()
  255.     {
  256.         //debug("getSelectedIndex");
  257.         return curIndex;
  258.     }
  259.  
  260.     /**
  261.      * Replaces a page at the index specified.
  262.      * @param index the zero-relative index of the page to change
  263.      * @param comp the new component
  264.      * @see #getComponentAt
  265.      * @exception PropertyVetoException
  266.      * if the specified property value is unacceptable
  267.      * @exception ArrayIndexOutOfBoundsException
  268.      * if the index is invalid
  269.      * @exception IllegalArgumentException
  270.      * if the component is null
  271.      */
  272.     public void setComponentAt(int index, Component comp) throws PropertyVetoException
  273.     {
  274.         //debug("setComponentAt");
  275.  
  276.         if (!isIndexValid(index))
  277.             throw new ArrayIndexOutOfBoundsException();
  278.  
  279.         if (comp == null)
  280.             throw new IllegalArgumentException();
  281.  
  282.         Component oldPage = getComponentAt(index);
  283.         vetos.fireVetoableChange("ComponentAt", oldPage, comp);
  284.  
  285.         vPages.setElementAt(comp, index);
  286.         if (index == curIndex)
  287.         {
  288.             hidePage();
  289.             showPage(comp);
  290.         }
  291.  
  292.         changes.firePropertyChange("ComponentAt", oldPage, comp);
  293.     }
  294.  
  295.     /**
  296.      * Gets the component for the page at the given index.
  297.      * @param index zero-relative index of the page
  298.      * @return returns the component associated with the page
  299.      * @exception ArrayIndexOutOfBoundsException
  300.      * if the index is invalid
  301.      * @see #setComponentAt
  302.      */
  303.     public Component getComponentAt(int index)
  304.     {
  305.         //debug("getComponentAt");
  306.  
  307.         if (!isIndexValid(index))
  308.             throw new ArrayIndexOutOfBoundsException();
  309.  
  310.         return (Component)vPages.elementAt(index);
  311.     }
  312.  
  313.     /**
  314.      * Shows or hides the Help button depending on the value of the parameter.
  315.      *
  316.      * @exception PropertyVetoException
  317.      * if the specified property value is unacceptable
  318.      * @see #isHelpButtonVisible
  319.      */
  320.     public void setHelpButtonVisible(boolean visible) throws PropertyVetoException
  321.     {
  322.         if (visible == helpButtonVisible)
  323.             return;
  324.  
  325.         Boolean oldvalue = new Boolean(helpButtonVisible);
  326.         Boolean newvalue = new Boolean(visible);
  327.  
  328.         vetos.fireVetoableChange("HelpButtonVisible", oldvalue, newvalue);
  329.  
  330.         if (visible && !helpButtonVisible)
  331.         {
  332.             panel4.add(helpButton);
  333.             helpButtonVisible = true;
  334.         }
  335.         else if (!visible && helpButtonVisible)
  336.         {
  337.             panel4.remove(helpButton);
  338.             helpButtonVisible = false;
  339.         }
  340.  
  341.         changes.firePropertyChange("HelpButtonVisible", oldvalue, newvalue);
  342.     }
  343.  
  344.     /**
  345.      * Determines whether the Help button is visible.
  346.      *
  347.      * @see #setHelpButtonVisible
  348.      */
  349.     public boolean isHelpButtonVisible()
  350.     {
  351.         return helpButtonVisible;
  352.     }
  353.  
  354.     /**
  355.      * Sets a combined Next/Finish button or two buttons depending on the
  356.      * value of the parameter.
  357.      *
  358.      * @exception PropertyVetoException
  359.      * if the specified property value is unacceptable
  360.      * @see #isCombinedButton
  361.      */
  362.     public void setCombinedButton(boolean combined) throws PropertyVetoException
  363.     {
  364.         if (combined == combinedButton)
  365.             return;
  366.  
  367.         Boolean oldvalue = new Boolean(combinedButton);
  368.         Boolean newvalue = new Boolean(combined);
  369.  
  370.         vetos.fireVetoableChange("combinedButton", oldvalue, newvalue);
  371.  
  372.         if (combined && !combinedButton)
  373.         {
  374.             panel3.remove(finishButton);
  375.             combinedButton = true;
  376.         }
  377.         else if (!combined && combinedButton)
  378.         {
  379.             panel3.add(finishButton);
  380.             combinedButton = false;
  381.         }
  382.  
  383.         changes.firePropertyChange("combinedButton", oldvalue, newvalue);
  384.     }
  385.  
  386.     /**
  387.      * Determines whether there is a combined Next/Finish button.
  388.      *
  389.      * @see #setCombinedButton
  390.      */
  391.     public boolean isCombinedButton()
  392.     {
  393.         return combinedButton;
  394.     }
  395.  
  396.     /**
  397.      * Sets the buttons alignment of the navigation buttons.
  398.      *
  399.      * @param align
  400.      * Wizard.LEFT, Wizard.CENTER or Wizard.RIGHT
  401.      * @exception PropertyVetoException
  402.      * if the specified property value is unacceptable
  403.      * @exception IllegalArgumentException
  404.      * if the parameter is invalid
  405.      * @see #getButtonsAlignment
  406.      */
  407.     public void setButtonsAlignment(int align) throws PropertyVetoException
  408.     {
  409.         if ((align != LEFT) && (align != CENTER) && (align != RIGHT))
  410.             throw new IllegalArgumentException();
  411.  
  412.         Integer oldvalue = new Integer(getButtonsAlignment());
  413.         Integer newvalue = new Integer(align);
  414.  
  415.         vetos.fireVetoableChange("buttonsAlignment", oldvalue, newvalue);
  416.         ((FlowLayout)panel2.getLayout()).setAlignment(align);
  417.         panel2.invalidate();
  418.         //panel2.doLayout();
  419.         changes.firePropertyChange("buttonsAlignment", oldvalue, newvalue);
  420.     }
  421.  
  422.     /**
  423.      * Gets the buttons alignment of the navigation buttons.
  424.      *
  425.      * @see #setButtonsAlignment
  426.      */
  427.     public int getButtonsAlignment()
  428.     {
  429.         return ((FlowLayout)panel2.getLayout()).getAlignment();
  430.     }
  431.  
  432.     /**
  433.      * Gets the index for a specific page.
  434.      * @param comp the page to get the index of
  435.      * @return the zero-relative index of the page or -1 if it is not found
  436.      * @exception IllegalArgumentException
  437.      * if the component is null
  438.      */
  439.     public int getPageIndex(Component comp)
  440.     {
  441.            //debug("getPageIndex");
  442.         if (comp == null)
  443.             throw new IllegalArgumentException();
  444.         return vPages.indexOf(comp);
  445.     }
  446.  
  447.     /**
  448.      * Show and select the page at the given index.
  449.      * The page is activated, ready for user input.
  450.      * @param index zero-relative index of the page to select
  451.      */
  452.     private void showPageAt(int index)
  453.     {
  454.         //debug("showPageAt: " + index);
  455.  
  456.         // Check index
  457.  
  458.         if (!isIndexValid(index))
  459.             return;
  460.  
  461.         if (index != curIndex)
  462.         {
  463.             hidePage();
  464.             showPage(getComponentAt(index));
  465.             curIndex = index;
  466.         }
  467.     }
  468.  
  469.     /**
  470.      * Hides the current component component.
  471.      * This is a low-level method.
  472.      * @param comp the Component to add and show
  473.      */
  474.     private void hidePage()
  475.     {
  476.         //debug("hidePage");
  477.         if (userComponent != null)
  478.         {
  479.             userComponent.setVisible(false);
  480.             userComponent = null;
  481.         }
  482.     }
  483.  
  484.     /**
  485.      * Adds the component to the base panel and shows it.
  486.      * This is a low-level method used by showPageAt and
  487.      * setComponentAt only.
  488.      * @param comp the Component to add and show
  489.      */
  490.     private void showPage(Component comp)
  491.     {
  492.         //debug("showPage");
  493.  
  494.         // Register the new component
  495.  
  496.         userComponent = comp;
  497.  
  498.         if (userComponent != null)
  499.         {
  500.             // Add the component to the panel1 only if it has not already be done
  501.  
  502.             Component[] comps = panel1.getComponents();
  503.             int l = comps.length;
  504.             int x;
  505.             for (x = 0; x < l; x++)
  506.             {
  507.                 if (comps[x] == userComponent)
  508.                     break;
  509.             }
  510.             if (x == l) {
  511.                 panel1.add(userComponent, -1);
  512.                 //debug("showPage: adding component " + comp);
  513.             }
  514.  
  515.             // Show and request focus...
  516.  
  517.             userComponent.setVisible(true);
  518.             userComponent.requestFocus();
  519.             //userComponent.invalidate();
  520.             validate();
  521.         }
  522.     }
  523.  
  524.     /**
  525.      * Check if the specified index is in a valid range.
  526.      * @param index the index to test
  527.      */
  528.     private boolean isIndexValid(int index)
  529.     {
  530.         return ((index >=0) && (index < getPageCount())) ? true : false;
  531.     }
  532.  
  533.     /**
  534.      * Removes a page and its associated component at the given index.
  535.      * The currently active page cannot be removed.
  536.      * @param index zero-relative index of the page
  537.      * @exception ArrayIndexOutOfBoundsException
  538.      * if the index is invalid
  539.      */
  540.     public void removePageAt(int index)
  541.     {
  542.         //debug("removePageAt: " + index);
  543.  
  544.         if (!isIndexValid(index))
  545.             throw new ArrayIndexOutOfBoundsException();
  546.  
  547.         int oldSize = getPageCount();
  548.  
  549.         // Check if the current page will be removed
  550.  
  551.         if (index == curIndex)
  552.         {
  553.             if (getPageCount() == 1)
  554.             {
  555.                 // It is the last remaining page
  556.  
  557.                 if (userComponent != null)
  558.                     userComponent.setVisible(false);
  559.                 curIndex = -1;
  560.                 if (controllerPrepared)
  561.                 {
  562.                     controller.doCancel();
  563.                     controllerPrepared = false;
  564.                 }
  565.             }
  566.             else if (curIndex == (getPageCount() - 1))
  567.             {
  568.                 // It is the last page index
  569.  
  570.                 showPageAt(curIndex - 1);
  571.             }
  572.             else
  573.             {
  574.                 showPageAt(curIndex + 1);
  575.             }
  576.         }
  577.  
  578.         // Remove everything
  579.  
  580.         Component p = getComponentAt(index);
  581.         panel1.remove(p);
  582.         vPages.removeElementAt(index);
  583.  
  584.         // Update current index
  585.  
  586.         if ((curIndex != -1) && (index < curIndex))
  587.             curIndex--;
  588.  
  589.         updateButtonsState();
  590.  
  591.         int newSize = getPageCount();
  592.         changes.firePropertyChange("PageCount", new Integer(oldSize), new Integer(newSize));
  593.     }
  594.  
  595.     /**
  596.      * Removes all pages and their associated components, clearing
  597.      * the Wizard entirely.
  598.      */
  599.     public void removeAllPages()
  600.     {
  601.         //debug("removeAllPages");
  602.         if (userComponent != null)
  603.                userComponent.setVisible(false);
  604.            userComponent = null;
  605.         vPages = new Vector();
  606.         curIndex = -1;
  607.         if (controllerPrepared)
  608.         {
  609.             controller.doCancel();
  610.                controllerPrepared = false;
  611.            }
  612.         panel1.removeAll();
  613.         updateButtonsState();
  614.     }
  615.  
  616.     /**
  617.      * Gets the number of pages in the Wizard.
  618.      * @return the number of pages currently in the Wizard
  619.      */
  620.     public int getPageCount()
  621.     {
  622.         //debug("getPageCount: " + vPages.size());
  623.         return vPages.size();
  624.     }
  625.  
  626.     /**
  627.      * Adds a listener for all event changes.
  628.      * @param listener the listener to add.
  629.      * @see #removePropertyChangeListener
  630.      */
  631.     public void addPropertyChangeListener(PropertyChangeListener listener)
  632.     {
  633.         //debug("addPropertyChangeListener");
  634.         changes.addPropertyChangeListener(listener);
  635.     }
  636.  
  637.     /**
  638.      * Removes a listener for all event changes.
  639.      * @param listener the listener to remove.
  640.      * @see #addPropertyChangeListener
  641.      */
  642.     public void removePropertyChangeListener(PropertyChangeListener listener)
  643.     {
  644.         //debug("removePropertyChangeListener");
  645.         changes.removePropertyChangeListener(listener);
  646.     }
  647.  
  648.     /**
  649.      * Adds a vetoable listener for all event changes.
  650.      * @param listener the listener to add.
  651.      * @see #removeVetoableChangeListener
  652.      */
  653.     public void addVetoableChangeListener(VetoableChangeListener listener)
  654.     {
  655.         //debug("addVetoableChangeListener");
  656.         vetos.addVetoableChangeListener(listener);
  657.     }
  658.  
  659.     /**
  660.      * Removes a vetoable listener for all event changes.
  661.      * @param listener the listener to remove.
  662.      * @see #addVetoableChangeListener
  663.      */
  664.     public void removeVetoableChangeListener(VetoableChangeListener listener)
  665.     {
  666.         //debug("removeVetoableChangeListener");
  667.         vetos.removeVetoableChangeListener(listener);
  668.     }
  669.  
  670.     /**
  671.      * Adds the specified action listener to receive action events from
  672.      * the Finish button.
  673.      *
  674.      * @see #removeActionListener
  675.      */
  676.     public void addActionListener(ActionListener l)
  677.     {
  678.         actionListeners.addElement(l);
  679.     }
  680.  
  681.     /**
  682.      * Removes the specified action listener so that it no longer receives
  683.      * action events from the Finish button.
  684.      *
  685.      * @see #addActionListener
  686.      */
  687.     public void removeActionListener(ActionListener l)
  688.     {
  689.         actionListeners.removeElement(l);
  690.     }
  691.  
  692.     /**
  693.      * Fires an action event to all registered listeners.
  694.      *
  695.      * @see #addActionListener
  696.      * @see #removeActionListener
  697.      */
  698.     private void fireActionEvent(String command)
  699.     {
  700.         ActionEvent event = new ActionEvent(this, 0, command);
  701.  
  702.         for (Enumeration e = actionListeners.elements(); e.hasMoreElements();)
  703.         {
  704.             ActionListener l = (ActionListener)e.nextElement();
  705.             l.actionPerformed(event);
  706.         }
  707.     }
  708.  
  709.     // Methods overriding Container methods
  710.  
  711.     /**
  712.      * Adds the specified component to this container at the specified
  713.      * index. This method also notifies the layout manager to add 
  714.      * the component to this container's layout using the specified 
  715.      * constraints object.
  716.      * <p>
  717.      * This is the method to override if a program needs to track 
  718.      * every add request to a container. An overriding method should 
  719.      * usually include a call to the superclass's version of the method:
  720.      * <p>
  721.      * <blockquote>
  722.      * <code>super.addImpl(comp, constraints, index)</code>
  723.      * </blockquote>
  724.      * <p>
  725.      * @param     comp       the component to be added.
  726.      * @param     constraints an object expressing layout contraints 
  727.      *                 for this component.
  728.      * @param     index the position in the container's list at which to
  729.      *                 insert the component, where <code>-1</code> 
  730.      *                 means insert at the end.
  731.      * @see       java.awt.Container#add(java.awt.Component)       
  732.      * @see       java.awt.Container#add(java.awt.Component, int)       
  733.      * @see       java.awt.Container#add(java.awt.Component, java.lang.Object)       
  734.      * @see       java.awt.LayoutManager
  735.      * @since     JDK1.1
  736.      */
  737.     protected void addImpl(Component comp, Object constraints, int index)
  738.     {
  739.         //debug("addImpl: " + comp + ", " + constraints + ", " + index);
  740.  
  741.         if (comp == null)
  742.             throw new IllegalArgumentException();
  743.  
  744.         int oldSize = getPageCount();
  745.         int index1;
  746.  
  747.         // Add page and label
  748.  
  749.         if (index == -1)
  750.         {
  751.             index1 = getPageCount();
  752.             vPages.addElement(comp);
  753.         }
  754.         else
  755.         {
  756.             index1 = index;
  757.             vPages.insertElementAt(comp, index1);
  758.         }
  759.         
  760.         // Update current index
  761.  
  762.         if ((curIndex != -1) && (index1 <= curIndex))
  763.             curIndex++;
  764.  
  765.         // Try to show the new page
  766.  
  767.         if (!ignoreDesignTime && java.beans.Beans.isDesignTime())
  768.         {
  769.             // Show the pages as they are added
  770.  
  771.             showPageAt(index1);
  772.         }
  773.         else if (!controllerPrepared)//curIndex == -1
  774.         {
  775.             // Show the first page only
  776.  
  777.             if (index1 == firstPageIndex)
  778.                 initiateController(firstPageIndex);
  779.         }
  780.  
  781.         // Set the buttons status
  782.  
  783.         updateButtonsState();
  784.  
  785.         // Fire the page count change
  786.  
  787.         int newSize = getPageCount();
  788.         changes.firePropertyChange("PageCount", new Integer(oldSize), new Integer(newSize));
  789.     }
  790.     
  791.     /**
  792.      * Removes the specified component from this container.
  793.      * This is a standard Java AWT method which gets called to remove
  794.      * a component from a container. When this happens the component's
  795.      * removeNotify() will also get called to indicate component
  796.      * removal.
  797.      *
  798.      * @param comp the component to remove
  799.      * @see java.awt.Component#add
  800.      */
  801.     public void remove(Component comp)
  802.     {
  803.         //debug("remove");
  804.         if (comp == null)
  805.             return;
  806.         removePageAt(getPageIndex(comp));
  807.     }
  808.  
  809.     /**
  810.      * Removes the component, specified by <code>index</code>, from
  811.      * this container.
  812.      * This is a standard Java AWT method which gets called to remove
  813.      * a component from a container. When this happens the component's
  814.      * removeNotify() will also get called to indicate component
  815.      * removal.
  816.      *
  817.      * @param comp the component to remove
  818.      * @see java.awt.Component#add
  819.      */
  820.     public void remove(int index)
  821.     {
  822.         //debug("remove");
  823.         removePageAt(index);
  824.     }
  825.  
  826.     /**
  827.      * Tells this component that it has been added to a container.
  828.      * This is a standard Java AWT method which gets called by the AWT when
  829.      * this component is added to a container. Typically, it is used to
  830.      * create this component's peer.
  831.      *
  832.      * It has been overridden here to hook-up event listeners.
  833.      *
  834.      * @see #removeNotify
  835.      */
  836.     public void addNotify()
  837.     {
  838.         //debug("addNotify");
  839.         super.addNotify();
  840.  
  841.         // Hook up listeners
  842.  
  843.         if ((mouse == null) && !ignoreDesignTime && java.beans.Beans.isDesignTime())
  844.         {
  845.             mouse = new Mouse();
  846.             addMouseListener(mouse);
  847.         }
  848.  
  849.         if (action == null)
  850.         {
  851.             action = new Action();
  852.  
  853.             previousButton.addActionListener(action);
  854.             nextButton.addActionListener(action);
  855.             finishButton.addActionListener(action);
  856.             cancelButton.addActionListener(action);
  857.             helpButton.addActionListener(action);
  858.         }
  859.     }
  860.  
  861.     /**
  862.      * Tells this component that it is being removed from a container.
  863.      * This is a standard Java AWT method which gets called by the AWT when
  864.      * this component is removed from a container. Typically, it is used to
  865.      * destroy the peers of this component and all its subcomponents.
  866.      *
  867.      * It has been overridden here to unhook event listeners.
  868.      *
  869.      * @see #addNotify
  870.      */
  871.     public void removeNotify()
  872.     {
  873.         //debug("removeNotify");
  874.  
  875.         //Unhook listeners
  876.  
  877.         if (mouse != null)
  878.         {
  879.             removeMouseListener(mouse);
  880.             mouse = null;
  881.         }
  882.  
  883.         if (action != null)
  884.         {
  885.             previousButton.removeActionListener(action);
  886.             nextButton.removeActionListener(action);
  887.             finishButton.removeActionListener(action);
  888.             cancelButton.removeActionListener(action);
  889.             helpButton.removeActionListener(action);
  890.  
  891.             action = null;
  892.         }
  893.  
  894.         super.removeNotify();
  895.     }
  896.  
  897.     /**
  898.      * Takes no action.
  899.      * This is a standard Java AWT method which gets called to specify
  900.      * which layout manager should be used to layout the components in
  901.      * standard containers.
  902.      *
  903.      * Since layout managers CANNOT BE USED with this container the standard
  904.      * setLayout has been OVERRIDDEN for this container and does nothing.
  905.      *
  906.      * @param mgr the layout manager to use to layout this container's components
  907.      * (IGNORED)
  908.      * @see java.awt.Container#getLayout
  909.      **/
  910.     public void setLayout(LayoutManager mgr)
  911.     {
  912.         //debug("setLayout");
  913.     }
  914.  
  915.     public LayoutManager getLayout()
  916.     {
  917.         //debug("getLayout");
  918.         return null;
  919.     }
  920.  
  921.     /**
  922.      * Handles the laying out of components within this component.
  923.      * This is a standard Java AWT method which gets called by the AWT
  924.      * when this component is validated with the validate() method.
  925.      *
  926.      * @see java.awt.Container#validate
  927.      */
  928.     public void doLayout()
  929.     {
  930.         //debug("doLayout");
  931.  
  932.         super.doLayout();
  933.  
  934.         if (userComponent != null)
  935.         {
  936.             Rectangle r = panel1.getBounds();
  937.             //if ((r.width != 0) && (r.height != 0))
  938.                 userComponent.setBounds(0, 0, r.width, r.height);
  939.             //userComponent.invalidate();
  940.             //userComponent.validate();
  941.         }
  942.     }
  943.  
  944.     /**
  945.      * Sets the background color of this component.
  946.      */
  947.     public void setBackground(Color color)
  948.     {
  949.         super.setBackground(color);
  950.         // Why has this to be done?
  951.         panel1.setBackground(color);
  952.         panel2.setBackground(color);
  953.         panel3.setBackground(color);
  954.         panel4.setBackground(color);
  955.     }
  956.  
  957.     // Inner classes
  958.  
  959.     /**
  960.      * This is the Mouse Event handling innerclass. It handles mouse events
  961.      * at design time only.
  962.      */
  963.     class Mouse extends MouseAdapter implements java.io.Serializable
  964.     {
  965.         public void mousePressed(MouseEvent e)
  966.         {
  967.             //System.err.println("Before mouse click...");
  968.             //System.err.println("Mouse click: " + e.getPoint().x + ", " + e.getPoint().y);
  969.  
  970.             Component c = getComponentAt(e.getPoint());
  971.  
  972.             //System.err.println("  class: " + c.getClass().getName());
  973.  
  974.             if (c == panel2)
  975.             {
  976.                 e.translatePoint(-panel2.getLocation().x, -panel2.getLocation().y);
  977.                 c = panel2.getComponentAt(e.getPoint());
  978.                 //System.err.println("  panel2: " + e.getPoint());
  979.  
  980.                 if (c == panel3)
  981.                 {
  982.                     e.translatePoint(-panel3.getLocation().x, -panel3.getLocation().y);
  983.                     c = panel3.getComponentAt(e.getPoint());
  984.                     //System.err.println("  panel3: " + e.getPoint());
  985.  
  986.                     if (c == previousButton)
  987.                         goPrevious();
  988.                     else if (c == nextButton)
  989.                         goNext();
  990.                     else
  991.                         ;//System.err.println("none");
  992.                 }
  993.                 else if (c == panel4)
  994.                 {
  995.                     e.translatePoint(-panel4.getLocation().x, -panel4.getLocation().y);
  996.                     c = panel4.getComponentAt(e.getPoint());
  997.                     System.err.println("  panel4: " + e.getPoint());
  998.  
  999.                     if (c == cancelButton)
  1000.                         ;//System.err.println("cancel");
  1001.                     else if (c == helpButton)
  1002.                         ;//System.err.println("help");
  1003.                     else
  1004.                         ;//System.err.println("none");
  1005.                 }
  1006.                 else
  1007.                 {
  1008.                     //System.err.println("none");
  1009.                 }
  1010.             }
  1011.         }
  1012.     }
  1013.  
  1014.     /**
  1015.      * This is the Action Event handling innerclass.
  1016.      */
  1017.     class Action implements ActionListener, java.io.Serializable
  1018.     {
  1019.         public void actionPerformed(ActionEvent e)
  1020.         {
  1021.             Object o = e.getSource();
  1022.  
  1023.             if (o == previousButton)
  1024.                 goPrevious();
  1025.             else if ((o == nextButton) && (!combinedButton || !controller.isFinishEnabled()))
  1026.                 goNext();
  1027.             else if ((o == finishButton) || ((o == nextButton) && combinedButton && controller.isFinishEnabled()))
  1028.                 doFinish();
  1029.             else if (o == cancelButton)
  1030.                 doCancel();
  1031.             else if (o == helpButton)
  1032.                 doHelp();
  1033.         }
  1034.     }
  1035.  
  1036.     /**
  1037.      * Performs the actions needed when the Finish button is pressed.
  1038.      *
  1039.      * @see #doCancel
  1040.      * @see #doHelp
  1041.      */
  1042.     public void doFinish()
  1043.     {
  1044.         //debug("doFinish");
  1045.  
  1046.         Component source = (curIndex != -1) ? getComponentAt(curIndex) : null;
  1047.  
  1048.         if (source == null)
  1049.             return;
  1050.  
  1051.         if (controller.validatePage(source, null, WizardController.FINISH))
  1052.         {
  1053.             controller.doFinish();
  1054.             controllerPrepared = false;
  1055.             fireActionEvent("Finish");
  1056.         }
  1057.     }
  1058.  
  1059.     /**
  1060.      * Performs the actions needed when the Cancel button is pressed.
  1061.      *
  1062.      * @see #doFinish
  1063.      * @see #doHelp
  1064.      */
  1065.     public void doCancel()
  1066.     {
  1067.         //debug("doCancel");
  1068.  
  1069.         Component source = (curIndex != -1) ? getComponentAt(curIndex) : null;
  1070.  
  1071.         if (source == null)
  1072.             return;
  1073.  
  1074.         if (controller.validatePage(source, null, WizardController.CANCEL))
  1075.         {
  1076.             controller.doCancel();
  1077.             controllerPrepared = false;
  1078.             fireActionEvent("Cancel");
  1079.         }
  1080.     }
  1081.  
  1082.     /**
  1083.      * Performs the actions needed when the Help button is pressed.
  1084.      *
  1085.      * @see #doFinish
  1086.      * @see #doCancel
  1087.      */
  1088.     public void doHelp()
  1089.     {
  1090.         //debug("doHelp");
  1091.  
  1092.         Component source = (curIndex != -1) ? getComponentAt(curIndex) : null;
  1093.  
  1094.         if (source == null)
  1095.             return;
  1096.  
  1097.         if (controller.validatePage(source, null, WizardController.HELP))
  1098.         {
  1099.             controller.doHelp();
  1100.             fireActionEvent("Help");
  1101.         }
  1102.     }
  1103.  
  1104.     // Implementation of the WizardInterface interface
  1105.  
  1106.     /**
  1107.      * Sets the index of the page to show when goPrevious is called.
  1108.      *
  1109.      * @see #setNextPageIndex
  1110.      * @see #goPrevious
  1111.      * @see WizardController
  1112.      * @see SimpleWizardController
  1113.      */
  1114.     public void setPreviousPageIndex(int index)
  1115.     {
  1116.         //debug("setPreviousPageIndex");
  1117.         controller.setPreviousPageIndex(index);
  1118.     }
  1119.  
  1120.     /**
  1121.      * Sets the index of the page to show when goNext is called.
  1122.      *
  1123.      * @see #setPreviousPageIndex
  1124.      * @see #goNext
  1125.      * @see WizardController
  1126.      * @see SimpleWizardController
  1127.      */
  1128.     public void setNextPageIndex(int index)
  1129.     {
  1130.         //debug("setNextPageIndex");
  1131.         controller.setNextPageIndex(index);
  1132.     }
  1133.  
  1134.     /**
  1135.      * Sets the page to show when goPrevious is called.
  1136.      *
  1137.      * @see #setNextPageIndex
  1138.      * @see #goPrevious
  1139.      * @see WizardController
  1140.      * @see SimpleWizardController
  1141.      */
  1142.     public void setPreviousPage(Component comp)
  1143.     {
  1144.         controller.setPreviousPage(comp);
  1145.     }
  1146.  
  1147.     /**
  1148.      * Sets the page to show when goNext is called.
  1149.      *
  1150.      * @see #setPreviousPageIndex
  1151.      * @see #goNext
  1152.      * @see WizardController
  1153.      * @see SimpleWizardController
  1154.      */
  1155.     public void setNextPage(Component comp)
  1156.     {
  1157.         controller.setNextPage(comp);
  1158.     }
  1159.  
  1160.     /**
  1161.      * Go to the previous page.
  1162.      * If a page has been selected with setPreviousPage it will be used.
  1163.      * If a page index has been selected with setPreviousPageIndex it will be
  1164.      * used unless a page has been specified. The chain information will be
  1165.      * reset.
  1166.      *
  1167.      * @see #goNext
  1168.      * @see #setPreviousPage
  1169.      * @see #setPreviousPageIndex
  1170.      */
  1171.     public void goPrevious()
  1172.     {
  1173.         //debug("goPrevious");
  1174.  
  1175.         // Determines the source and target
  1176.  
  1177.         Component source = (curIndex != -1) ? getComponentAt(curIndex) : null;
  1178.         Component target = controller.getPreviousPage();
  1179.  
  1180.         //if (target == null)
  1181.         //    return;
  1182.  
  1183.         int index = getPageIndex(target);
  1184.         // Validate the current page and continue if validation succeeded
  1185.  
  1186.         if (curIndex != -1)
  1187.         {
  1188.             if (!controller.validatePage(source, target, WizardController.PREVIOUS))
  1189.                 return;
  1190.         }
  1191.  
  1192.         // Determines the real target and continue if the new target is valid
  1193.  
  1194.         target = controller.getPreviousPage();
  1195.  
  1196.         if (target == null)
  1197.             return;
  1198.  
  1199.         index = getPageIndex(target);
  1200.  
  1201.         // Hide the current page
  1202.  
  1203.         if (curIndex != -1)
  1204.         {
  1205.             hidePage();
  1206.             controller.pageHidden(source);
  1207.         }
  1208.  
  1209.         // Prepare the controller if needed
  1210.  
  1211.         /*
  1212.         if (!controllerPrepared)
  1213.         {
  1214.             controller.doPrepare();
  1215.             controllerPrepared = true;
  1216.         }
  1217.         */
  1218.  
  1219.         // Prepare the new page
  1220.  
  1221.         controller.resetChainInfo();
  1222.         controller.preparePage(target, WizardController.PREVIOUS);
  1223.  
  1224.         // Show the new page
  1225.  
  1226.         showPage(target);
  1227.         curIndex = index;
  1228.         controller.pageShown(target);
  1229.  
  1230.         // Set state information
  1231.  
  1232.         updateButtonsState();
  1233.     }
  1234.  
  1235.     /**
  1236.      * Go to the next page.
  1237.      * If a page has been selected with setNextPage it will be used.
  1238.      * If a page index has been selected with setNextPageIndex it will be
  1239.      * used unless a page has been specified. The chain information will be
  1240.      * reset.
  1241.      *
  1242.      * @see #goPrevious
  1243.      * @see #setNextPage
  1244.      * @see #setNextPageIndex
  1245.      */
  1246.     public void goNext()
  1247.     {
  1248.         //debug("goNext");
  1249.  
  1250.         // Determines the source and target
  1251.  
  1252.         Component source = (curIndex != -1) ? getComponentAt(curIndex) : null;
  1253.         Component target = controller.getNextPage();
  1254.  
  1255.         //if (target == null)
  1256.         //    return;
  1257.  
  1258.         int index = getPageIndex(target);
  1259.  
  1260.         // Validate the current page and continue if validation succeeded
  1261.  
  1262.         if (curIndex != -1)
  1263.         {
  1264.             if (!controller.validatePage(source, target, WizardController.NEXT))
  1265.                 return;
  1266.         }
  1267.  
  1268.         // Determines the real target and continue if the new target is valid
  1269.  
  1270.         target = controller.getNextPage();
  1271.  
  1272.         if (target == null)
  1273.             return;
  1274.  
  1275.         index = getPageIndex(target);
  1276.  
  1277.         // Hide the current page
  1278.  
  1279.         if (curIndex != -1)
  1280.         {
  1281.             hidePage();
  1282.             controller.pageHidden(source);
  1283.         }
  1284.  
  1285.         // Prepare the new page
  1286.  
  1287.         controller.resetChainInfo();
  1288.         controller.preparePage(target, WizardController.NEXT);
  1289.  
  1290.         // Show the new page
  1291.  
  1292.         showPage(target);
  1293.         curIndex = index;
  1294.         controller.pageShown(target);
  1295.  
  1296.         // Set state information
  1297.  
  1298.         updateButtonsState();
  1299.     }
  1300.  
  1301.     /**
  1302.      * Sets a default status for the Previous, Next and Finish buttons.
  1303.      *
  1304.      * @see #setPreviousEnabled
  1305.      * @see #setNextEnabled
  1306.      * @see #setFinishEnabled
  1307.      * @see #setCancelEnabled
  1308.      * @see #setHelpEnabled
  1309.      */
  1310.     public void updateButtonsState()
  1311.     {
  1312.         //debug("updateButtonsState");
  1313.  
  1314.         previousButton.setEnabled(controller.isPreviousEnabled());
  1315.         if (combinedButton)
  1316.         {
  1317.             updateCombinedButton();
  1318.         }
  1319.         else
  1320.         {
  1321.             nextButton.setEnabled(controller.isNextEnabled());
  1322.             finishButton.setEnabled(controller.isFinishEnabled());
  1323.         }
  1324.         cancelButton.setEnabled(controller.isCancelEnabled());
  1325.         helpButton.setEnabled(controller.isHelpEnabled());
  1326.     }
  1327.  
  1328.     private void updateCombinedButton()
  1329.     {
  1330.         String ntext = NEXT_LABEL;
  1331.         boolean nstatus = true;
  1332.         boolean nextEnabled = controller.isNextEnabled();
  1333.         boolean finishEnabled = controller.isFinishEnabled();
  1334.  
  1335.         if (!nextEnabled && !finishEnabled)
  1336.             nstatus = false;
  1337.         else if (!nextEnabled && finishEnabled)
  1338.             ntext = FINISH_LABEL;
  1339.  
  1340.         nextButton.setLabel(ntext);
  1341.         nextButton.setEnabled(nstatus);
  1342.     }
  1343.  
  1344.     /**
  1345.      * Enables or disables the Previous button.
  1346.      * @param status <code>true</code> to enable the button
  1347.      *
  1348.      * @see #setNextEnabled
  1349.      * @see #setFinishEnabled
  1350.      * @see #setCancelEnabled
  1351.      * @see #setHelpEnabled
  1352.      */
  1353.     public void setPreviousEnabled(boolean status)
  1354.     {
  1355.         controller.setPreviousEnabled(status);
  1356.         //previousButton.setEnabled(status);
  1357.     }
  1358.  
  1359.     /**
  1360.      * Enables or disables the Next button.
  1361.      * @param status <code>true</code> to enable the button
  1362.      *
  1363.      * @see #setPreviousEnabled
  1364.      * @see #setFinishEnabled
  1365.      * @see #setCancelEnabled
  1366.      * @see #setHelpEnabled
  1367.      */
  1368.     public void setNextEnabled(boolean status)
  1369.     {
  1370.         controller.setNextEnabled(status);
  1371.     }
  1372.  
  1373.     /**
  1374.      * Enables or disables the Finish button.
  1375.      * @param status <code>true</code> to enable the button
  1376.      *
  1377.      * @see #setPreviousEnabled
  1378.      * @see #setNextEnabled
  1379.      * @see #setCancelEnabled
  1380.      * @see #setHelpEnabled
  1381.      */
  1382.     public void setFinishEnabled(boolean status)
  1383.     {
  1384.         controller.setFinishEnabled(status);
  1385.     }
  1386.  
  1387.     /**
  1388.      * Enables or disables the Cancel button.
  1389.      * @param status <code>true</code> to enable the button
  1390.      *
  1391.      * @see #setPreviousEnabled
  1392.      * @see #setNextEnabled
  1393.      * @see #setFinishEnabled
  1394.      * @see #setHelpEnabled
  1395.      */
  1396.     public void setCancelEnabled(boolean status)
  1397.     {
  1398.         controller.setCancelEnabled(status);
  1399.     }
  1400.  
  1401.     /**
  1402.      * Enables or disables the Help button.
  1403.      * @param status <code>true</code> to enable the button
  1404.      *
  1405.      * @see #setPreviousEnabled
  1406.      * @see #setNextEnabled
  1407.      * @see #setFinishEnabled
  1408.      * @see #setCancelEnabled
  1409.      */
  1410.     public void setHelpEnabled(boolean status)
  1411.     {
  1412.         controller.setHelpEnabled(status);
  1413.     }
  1414.  
  1415.     /**
  1416.      * Return the Previous button component.
  1417.      */
  1418.     public Button getPreviousButton()
  1419.     {
  1420.         return previousButton;
  1421.     }
  1422.  
  1423.     /**
  1424.      * Return the Next button component.
  1425.      */
  1426.     public Button getNextButton()
  1427.     {
  1428.         return nextButton;
  1429.     }
  1430.  
  1431.     /**
  1432.      * Return the Finish button component.
  1433.      */
  1434.     public Button getFinishButton()
  1435.     {
  1436.         return finishButton;
  1437.     }
  1438.  
  1439.     /**
  1440.      * Return the Cancel button component.
  1441.      */
  1442.     public Button getCancelButton()
  1443.     {
  1444.         return cancelButton;
  1445.     }
  1446.  
  1447.     /**
  1448.      * Return the Help button component.
  1449.      */
  1450.     public Button getHelpButton()
  1451.     {
  1452.         return helpButton;
  1453.     } 
  1454.  
  1455.     /**
  1456.      * Set the button order for all instances of Wizard.
  1457.      * This should be called before instanciating a Wizard.
  1458.      */
  1459.     public static void setAlternativeButtonOrder(boolean order)
  1460.     {
  1461.         newButtonOrder = order;
  1462.     }
  1463.  
  1464.     /**
  1465.      * Get the button order for all instances of Wizard.
  1466.      */
  1467.     public static boolean getAlternativeButtonOrder()
  1468.     {
  1469.         return newButtonOrder;
  1470.     }
  1471.  
  1472.     // Member variables
  1473.  
  1474.     private WizardController controller;
  1475.  
  1476.     private boolean controllerPrepared = false;
  1477.     private boolean ignoreDesignTime = false;
  1478.  
  1479.     private VetoableChangeSupport vetos = new VetoableChangeSupport(this);
  1480.     private PropertyChangeSupport changes = new PropertyChangeSupport(this);
  1481.     private Vector vPages;
  1482.  
  1483.     private int firstPageIndex = 0;
  1484.     private int curIndex = -1;
  1485.     private Component userComponent = null;
  1486.  
  1487.     private Action action;
  1488.     private Mouse mouse;
  1489.  
  1490.     /**
  1491.      * The panel that contains the pages.
  1492.      */
  1493.     protected Panel panel1;
  1494.     /**
  1495.      * The horizontal line separating the pages from the navigation buttons.
  1496.      */
  1497.     protected symantec.itools.awt.shape.HorizontalLine horizontalLine1;
  1498.     /**
  1499.      * The top-level panel below the horizontal line.
  1500.      */
  1501.     protected Panel panel2;
  1502.     /**
  1503.      * The panel that contains the navigation (Back,Next,Finish) buttons.
  1504.      */
  1505.     protected Panel panel3;
  1506.     /**
  1507.      * The panel that contains the Cancel and Help buttons.
  1508.      */
  1509.     protected Panel panel4;
  1510.     /**
  1511.      * The Back button.
  1512.      */
  1513.     protected Button previousButton;
  1514.     /**
  1515.      * The Next button.
  1516.      */
  1517.     protected Button nextButton;
  1518.     /**
  1519.      * The Finish button.
  1520.      */
  1521.     protected Button finishButton;
  1522.     /**
  1523.      * The Cancel button.
  1524.      */
  1525.     protected Button cancelButton;
  1526.     /**
  1527.      * The Help button.
  1528.      */
  1529.     protected Button helpButton;
  1530.  
  1531.     private boolean helpButtonVisible = true;
  1532.     private boolean combinedButton = false;
  1533.  
  1534.     private Vector actionListeners;
  1535.  
  1536.     /**
  1537.      * The text used for the Back button.
  1538.      */
  1539.     protected static String PREVIOUS_LABEL;
  1540.     /**
  1541.      * The text used for the Next button.
  1542.      */
  1543.     protected static String NEXT_LABEL;
  1544.     /**
  1545.      * The text used for the Finish button.
  1546.      */
  1547.     protected static String FINISH_LABEL;
  1548.     /**
  1549.      * The text used for the Cancel button.
  1550.      */
  1551.     protected static String CANCEL_LABEL;
  1552.     /**
  1553.      * The text used for the Help button.
  1554.      */
  1555.     protected static String HELP_LABEL;
  1556.  
  1557.     /**
  1558.      * The resources.
  1559.      */
  1560.     static {
  1561.         ResourceBundle res = ResourceBundle.getBundle("symantec.itools.resources.ResBundle");
  1562.         PREVIOUS_LABEL = res.getString("wizard_label_previous");
  1563.         NEXT_LABEL     = res.getString("wizard_label_next");
  1564.         FINISH_LABEL   = res.getString("wizard_label_finish");
  1565.         CANCEL_LABEL   = res.getString("wizard_label_cancel");
  1566.         HELP_LABEL     = res.getString("wizard_label_help");
  1567.     }
  1568.  
  1569.     /**
  1570.      * Constant value indicating a layout aligned to the left.
  1571.      */
  1572.     public final static int LEFT = FlowLayout.LEFT;
  1573.     /**
  1574.      * Constant value indicating a layout centered.
  1575.      */
  1576.     public final static int CENTER = FlowLayout.CENTER;
  1577.     /**
  1578.      * Constant value indicating a layout aligned to the right.
  1579.      */
  1580.     public final static int RIGHT = FlowLayout.RIGHT;
  1581.  
  1582.     /**
  1583.      * The button order for all instances of wizards.
  1584.      */
  1585.     protected static boolean newButtonOrder = false;
  1586.  
  1587.     // Debug
  1588.  
  1589.     /*
  1590.     private void debug(String s) {
  1591.         fdebug("Wizard: " + s);
  1592.     }
  1593.  
  1594.     protected void fdebug(String s) {
  1595.         if (false)
  1596.         {
  1597.             try {
  1598.                 FileWriter fw = new FileWriter("d:\\temp\\w.log", true);
  1599.                 fw.write(s + "\n");
  1600.                 fw.close();
  1601.             } catch(IOException e) {
  1602.                 throw new RuntimeException("IOException caught in fdebug: " + e.getMessage());
  1603.             }
  1604.         }
  1605.         if (true)
  1606.             System.err.println(s);
  1607.     }
  1608.     */
  1609. }
  1610.